<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
    
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    Node.js简单入门介绍.md |  Small Bridge
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/css/main.css">

  
  <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
  
  

  

<link rel="alternate" href="/atom.xml" title="Small Bridge" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content">
      <section class="outer">
  <article id="post-Node-js简单入门介绍-md" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  Node.js简单入门介绍.md
</h1>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/09/07/Node-js%E7%AE%80%E5%8D%95%E5%85%A5%E9%97%A8%E4%BB%8B%E7%BB%8D-md/" class="article-date">
  <time datetime="2020-09-07T13:16:47.000Z" itemprop="datePublished">2020-09-07</time>
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/JavaScript/">JavaScript</a>
  </div>

      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">2.9k字</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">11分钟</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    
    <div class="article-entry" itemprop="articleBody">
      


      

      
      <p>@<a href="Node.js">TOC</a></p>
<h1 id="基础准备"><a href="#基础准备" class="headerlink" title="基础准备"></a>基础准备</h1><a id="more"></a>
<ol>
<li><p>命令行窗口的常用命令<br>dir 列出当前目录下的所有文件<br>cd 目录名  进入到指定的目录<br>md 目录名 创建一个文件夹<br>rd 目录名 删除一个文件夹<br>. 表示当前目录<br>.. 表示上一级目录</p>
</li>
<li><p>环境变量<br>当我们在命令行窗口打开一个文件或调用一个程序时，系统会首先在当前目录下寻找文件程序，如果找到了则直接打开，如果没有找到则会依次到环境变量path路径中寻找，直到找到为止，没有则报错,所以我们可以将一些经常需要访问的程序和文件的路径添加到path中，这样我们就可以在任意位置访问他们</p>
</li>
<li><p>进程和线程<br>进程负责为程序的运行提供必备的环境，进程就相当于工厂中的车间<br>线程是计算机中的最小计算单位，线程负责执行进程中的程序，线程就相当于工厂车间中的工人<br>JS是单线程的，Java是多线程的</p>
<h1 id="Node-js"><a href="#Node-js" class="headerlink" title="Node.js"></a>Node.js</h1></li>
<li><p>简介<br>是一个能够在服务器端运行JavaScript的JavaScript运行环境，采用Google开发的V8引擎运行JS代码<br><img src="https://img-blog.csdnimg.cn/20200619094317297.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQ0NjI1MTQy,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"><br>Node.js起初是用来写高性能服务器的，称作Webjs，Node.js是用来写单线程的服务器的，它处理请求时是单线程，但是在后台拥有一个I/O线程池，不像传统的服务器是多线程的，Node.js用途很多，比如：Web服务API(REST),实时多人游戏，后端的Web服务(跨域，服务端的请求)，基于Web的应用，多客户端的通信(即时通信)</p>
</li>
<li><p>COMMONJS规范</p>
</li>
</ol>
<p>ECMAScript标准的缺陷：</p>
<ul>
<li><p>没有模块系统</p>
</li>
<li><p>标准库较少</p>
</li>
<li><p>没有标准接口</p>
</li>
<li><p>缺乏管理系统<br>因此提供出了COMMONJS规范，希望JS能够在任何地方运行，它主要定义了模块的三个方面</p>
</li>
<li><p>模块引用</p>
</li>
<li><p>模块定义</p>
</li>
<li><p>模块标识<br>下面我们一一介绍<br>模块定义</p>
</li>
<li><p>在Node中，一个js文件就是一个模块</p>
</li>
<li><p>在Node中，每一个js文件中的代码都是独立运行在一个函数中，而不是全局作用域，所以一个模块中的变量和函数在其它模块中无法访问</p>
</li>
<li><p>我们可以通过exports来向外暴露变量和方法，只需要将需要暴露给外部的变量和方法设置为exports的属性即可</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">*  模块化</span></span><br><span class="line"><span class="comment">*       -在Node中，一个js文件就是一个模块</span></span><br><span class="line"><span class="comment">*       -在node中，每一个js文件中的代码都是独立运行在一个函数中</span></span><br><span class="line"><span class="comment">*       而不是全局作用域，所以一个模块中的变量和函数在其他模块中无法访问</span></span><br><span class="line"><span class="comment">* */</span></span><br><span class="line"></span><br><span class="line"><span class="built_in">console</span>.log(<span class="string">'我是一个模块,我是module02.js'</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">// var x = 10</span></span><br><span class="line"><span class="comment">// var y = 10</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">* 我们可以通过 exports 来向外暴露变量和方法</span></span><br><span class="line"><span class="comment">* 只需要将需要暴露给外部的变量或者方法设置为exports的属性即可</span></span><br><span class="line"><span class="comment">* */</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//向外部暴露属性和方法</span></span><br><span class="line"></span><br><span class="line">exports.x = <span class="string">'我是02_moudles的x'</span></span><br><span class="line">exports.y = <span class="string">'我是y'</span></span><br><span class="line">exports.fn = <span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">  </span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>模块引用</p>
</li>
<li><p>在Node中，通过require()函数来引入其它的模块</p>
</li>
<li><p>require()可以传递一个文件的路径作为参数，Node将会自动根据该路径引入外部模块，这里路径如果使用相对路径，必须以.或者..开头</p>
</li>
<li><p>引入模块以后，该函数会返回一个对象，这个对象代表的就是引入的模块</p>
</li>
</ul>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//引入其他模块</span></span><br><span class="line"></span><br><span class="line"><span class="comment">/*</span></span><br><span class="line"><span class="comment">* 在node中，通过require()函数来引入外部的模块</span></span><br><span class="line"><span class="comment">* require()可以传递一个文件的路径作为参数，node将会自动根据该路径来引入外部模块</span></span><br><span class="line"><span class="comment">* 这里路径，如果使用相对路径，必须以.或者..开头</span></span><br><span class="line"><span class="comment">*</span></span><br><span class="line"><span class="comment">* 使用require()引入模块以后，该函数会返回一个对象，这个对象代表的就是引入的模块</span></span><br><span class="line"><span class="comment">*</span></span><br><span class="line"><span class="comment">* 我们使用require引入外部模块时，使用的就是模块标识，我们可以通过模块标识来找到指定的模块</span></span><br><span class="line"><span class="comment">*</span></span><br><span class="line"><span class="comment">* 模块分成两大类</span></span><br><span class="line"><span class="comment">* 核心模块</span></span><br><span class="line"><span class="comment">*   --由node引擎提供的模块</span></span><br><span class="line"><span class="comment">*   --核心的标识就是模块的名字</span></span><br><span class="line"><span class="comment">* 文件模块</span></span><br><span class="line"><span class="comment">*   --由用户自己创建的模块</span></span><br><span class="line"><span class="comment">*   --文件模块的标识就是路径</span></span><br><span class="line"><span class="comment">* */</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> md = <span class="built_in">require</span>(<span class="string">"./02_moudles"</span>)</span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> fs = <span class="built_in">require</span>(<span class="string">'fs'</span>)</span><br><span class="line"></span><br><span class="line"><span class="built_in">console</span>.log(md)</span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> math = <span class="built_in">require</span>(<span class="string">'./math'</span>)</span><br><span class="line"></span><br><span class="line"><span class="built_in">console</span>.log(math.add(<span class="number">1</span>,<span class="number">2</span>),math.mul(<span class="number">1</span>,<span class="number">2</span>))</span><br><span class="line"></span><br><span class="line"><span class="built_in">console</span>.log(fs)</span><br></pre></td></tr></table></figure>
<h1 id="npm"><a href="#npm" class="headerlink" title="npm"></a>npm</h1><p>npm包管理器，使用npm可以对项目需要的包进行管理，这使得添加或者删除相关包变得极其简单，经常使用的指令有：<br>npm install 包名          向项目中添加某个包<br>npm uninstall 包名      移除项目中的某个包<br>npm install                  安装项目依赖中所有需要的包<br>修饰：<br>-g 表示全局安装<br>-dev  表示当前文件安装<br>–save  表示安装到项目依赖中</p>
<p>通过npm下载的包都放到了node_modules文件夹中，直接通过包名就可以引入使用了<br>node在使用模块的名字来引入模块时，它会首先在当前目录的node_modules中寻找是否含有该模块如果有则直接使用，如果没有则去上一级目录的node_modules中寻找没有继续上一级，直到磁盘的根目录，没有则报错</p>
<h1 id="Buffer缓冲区"><a href="#Buffer缓冲区" class="headerlink" title="Buffer缓冲区"></a>Buffer缓冲区</h1><p>Buffer(缓冲区)</p>
<ul>
<li><ul>
<li>Buffer的结构和数组很像，操作的方法也和数组类似</li>
</ul>
</li>
<li><ul>
<li>数组中不能存储二进制文件，而Buffer就是专门用来存储二进制数据</li>
</ul>
</li>
<li><ul>
<li>使用Buffer不需要引入，直接使用即可</li>
</ul>
</li>
<li><ul>
<li>在Buffer中存储的都是二进制数据，但是在显示的时候都是以16进制的形式显示</li>
</ul>
</li>
<li>buffer中每一个元素的范围是从00 - ff    (0 - 255)</li>
<li>00000000 - 11111111</li>
<li></li>
<li></li>
<li>计算机中 1个0 或 1个1 我们称为1位(bit)</li>
<li></li>
<li>8bit = 1byte(字节)</li>
<li></li>
<li>buffer中的一个元素，占用的内存就是一个字节</li>
<li>1024byte = 1kb</li>
<li>1024kb = 1mb</li>
<li>1024mb = 1gb</li>
<li>1024gb = 1tb</li>
<li></li>
<li>Buffer的大小一旦创建，则不能修改,Buffer实际上是对底层内存的直接操作<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> str = <span class="string">'Hello cxq'</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//将一个字符串保存到Buffer中</span></span><br><span class="line"><span class="keyword">var</span> buf = Buffer.from(str)</span><br><span class="line"></span><br><span class="line"><span class="built_in">console</span>.log(buf)</span><br><span class="line"></span><br><span class="line"><span class="built_in">console</span>.log(buf.length) <span class="comment">//占用内存的大小 (一个汉字3个字节)</span></span><br><span class="line"><span class="built_in">console</span>.log(str.length) <span class="comment">//字符串的长度</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">//创建一个指定大小的Buffer</span></span><br><span class="line"><span class="comment">//Buffer的所有构造函数都是不推荐使用的，废弃的，最好不用</span></span><br><span class="line"><span class="comment">// var buf2 = new Buffer(10) //10个字节的Buffer</span></span><br><span class="line"><span class="comment">// console.log(buf2.length)</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//创建指定大小的Buffer</span></span><br><span class="line"><span class="keyword">var</span> buf2 = Buffer.alloc(<span class="number">10</span>) <span class="comment">//10个字节的Buffer</span></span><br><span class="line"><span class="comment">//通过索引，来操作Buffer中的元素</span></span><br><span class="line">buf2[<span class="number">0</span>] = <span class="number">88</span></span><br><span class="line">buf2[<span class="number">1</span>] = <span class="number">255</span></span><br><span class="line">buf2[<span class="number">2</span>] = <span class="number">0xaa</span></span><br><span class="line"><span class="comment">// buf2[3] = 256 只能保存8位 且范围00000000 - 11111111 超出的舍去</span></span><br><span class="line"><span class="comment">// buf2[10] = 255 没用</span></span><br><span class="line"><span class="built_in">console</span>.log(buf2)</span><br><span class="line"></span><br><span class="line"><span class="comment">//只要数字在控制台或页面输出一定是10进制</span></span><br><span class="line"><span class="comment">// console.log(buf2[2])</span></span><br><span class="line"><span class="built_in">console</span>.log(buf2[<span class="number">2</span>].toString(<span class="number">16</span>))<span class="comment">//以16进制输出</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//遍历</span></span><br><span class="line"><span class="comment">// </span></span><br><span class="line"><span class="comment">// for (var i = 0; i &lt; buf2.length; i++) &#123;</span></span><br><span class="line"><span class="comment">//   console.log(buf2[i])</span></span><br><span class="line"><span class="comment">//  </span></span><br><span class="line"><span class="comment">// &#125;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//Buffer.allocUnsafe(size) 创建一个指定大小的buffer，但是buffer中可能含有敏感数据</span></span><br><span class="line"><span class="keyword">var</span> buf3 = Buffer.allocUnsafe(<span class="number">10</span>)</span><br><span class="line"><span class="built_in">console</span>.log(buf3)</span><br><span class="line"><span class="comment">//alloc分配内存空间的时候会将内存原来的数据清空</span></span><br><span class="line"><span class="comment">//但是allocUnsafe不会清空，所以有可能有值,一些敏感的数据。，安全性不高，但效率更高</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> buf4 = Buffer.from(<span class="string">'我是一段文本数据'</span>)</span><br><span class="line"><span class="built_in">console</span>.log(buf4.toString())</span><br></pre></td></tr></table></figure>
<h1 id="fs文件系统"><a href="#fs文件系统" class="headerlink" title="fs文件系统"></a>fs文件系统</h1>文件系统(File System)</li>
<li>-通过Node来操作系统中的文件</li>
<li>-使用文件系统，需要引入fs模块，fs是核心模块，直接引入不需要下载</li>
<li>文件的写入</li>
<li>-手动操作的步骤</li>
<li>1.打开文件</li>
<li><ul>
<li>fs.openSync(path,flags[,mode])</li>
</ul>
</li>
<li><ul>
<li>path 要打开文件的路径</li>
</ul>
</li>
<li><ul>
<li>flags 打开文件要做的操作的类型</li>
</ul>
</li>
<li>r 只读的</li>
<li>w 可写的</li>
<li><ul>
<li>mode 设置文件的操作权限，一般不传</li>
</ul>
</li>
<li>返回值</li>
<li>-该方法会返回一个文件的描述符作为结果，我们可以通过该描述符来对文件</li>
<li>进行各种操作</li>
<li></li>
<li></li>
<li>2.向文件中写入内容</li>
<li>fs.writeSync(fd,string[,position[,encoding]])</li>
<li><ul>
<li>fd 要写入文件的描述符</li>
</ul>
</li>
<li><ul>
<li>string 要写入的内容</li>
</ul>
</li>
<li><ul>
<li>position 写入的起始位置</li>
</ul>
</li>
<li><ul>
<li>encoding 写入的编码，一般是utf-8</li>
</ul>
</li>
<li>3.保存并关闭文件</li>
<li>fs.closeSync(fd)</li>
<li><ul>
<li>fd  文件描述符<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">ar fs = <span class="built_in">require</span>(<span class="string">'fs'</span>)</span><br><span class="line"><span class="comment">// console.log(fs)</span></span><br><span class="line"></span><br><span class="line"><span class="comment">//打开文件</span></span><br><span class="line"><span class="keyword">var</span> fd = fs.openSync(<span class="string">"hello.txt"</span>,<span class="string">"w"</span>)</span><br><span class="line"><span class="built_in">console</span>.log(fd)</span><br><span class="line"></span><br><span class="line"><span class="comment">//向文件中写入内容</span></span><br><span class="line">fs.writeSync(fd,<span class="string">"今天天气真不错！"</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">//关闭文件</span></span><br><span class="line">fs.closeSync(fd)</span><br></pre></td></tr></table></figure>
异步文件的写入</li>
</ul>
</li>
<li>fs.open(path,flags[,mode],callback)</li>
<li><ul>
<li>异步调用的方法，结果都是通过回调函数的参数返回的</li>
</ul>
</li>
<li><ul>
<li>回调函数有两个参数</li>
</ul>
</li>
<li>err 错误对象    如果没有错误则为null</li>
<li>fd 文件描述符</li>
<li></li>
<li></li>
<li>fs.write(fd,string[,position[,encoding]],callback)</li>
<li><ul>
<li>回调函数有三个参数</li>
</ul>
</li>
<li></li>
<li>fs.close(fd,callback)<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//引入fs模块</span></span><br><span class="line"><span class="keyword">var</span> fs = <span class="built_in">require</span>(<span class="string">'fs'</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">//打开文件</span></span><br><span class="line">fs.open(<span class="string">"hello2.txt"</span>,<span class="string">"w"</span>,<span class="function"><span class="keyword">function</span> (<span class="params">err,fd</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">if</span>(!err)&#123;</span><br><span class="line">    <span class="comment">//写入内容</span></span><br><span class="line">    fs.write(fd,<span class="string">"这是异步写入的内容"</span>,<span class="function"><span class="keyword">function</span> (<span class="params">err</span>) </span>&#123;</span><br><span class="line">      <span class="keyword">if</span>(!err)&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">"写入成功"</span>)</span><br><span class="line">      &#125;</span><br><span class="line">      <span class="comment">//关闭文件</span></span><br><span class="line">      fs.close(fd,<span class="function"><span class="keyword">function</span> (<span class="params">err</span>) </span>&#123;</span><br><span class="line">        <span class="keyword">if</span> (!err)&#123;</span><br><span class="line">          <span class="built_in">console</span>.log(<span class="string">"文件已关闭"</span>)</span><br><span class="line">        &#125; </span><br><span class="line">      &#125;)</span><br><span class="line">    &#125;)</span><br><span class="line">  &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(err)</span><br><span class="line">  &#125;</span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>
简单文件写入</li>
<li>fs.writeFile(file, data[, options], callback)</li>
<li>fs.writeFileSync(file, data[, options])</li>
<li><ul>
<li>file 要操作的文件的路径</li>
</ul>
</li>
<li><ul>
<li>data 要写入的数据</li>
</ul>
</li>
<li><ul>
<li>options 选项，可以对写入进行一些设置</li>
</ul>
</li>
<li><ul>
<li>callback 当写入完成以后执行的函数<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//引入fs模块</span></span><br><span class="line"><span class="keyword">var</span> fs = <span class="built_in">require</span>(<span class="string">'fs'</span>)</span><br><span class="line"></span><br><span class="line">fs.writeFile(<span class="string">'hello3.txt'</span>,<span class="string">"这是简单文件的写入"</span>,&#123;<span class="attr">flag</span>:<span class="string">'a'</span>&#125;,<span class="function"><span class="keyword">function</span> (<span class="params">err</span>) </span>&#123;</span><br><span class="line">  <span class="keyword">if</span>(!err)&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(<span class="string">"写入成功"</span>)</span><br><span class="line">  &#125;<span class="keyword">else</span>&#123;</span><br><span class="line">    <span class="built_in">console</span>.log(err);</span><br><span class="line">  &#125;</span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>
同步、异步、简单文件写入都不适合于大文件的写入，性能较差，容易导致内存溢出</li>
</ul>
</li>
</ul>
<p>流式文件写入<br>创建一个可写流</p>
<ul>
<li>fs.createWriteStream(path[,options])</li>
<li><ul>
<li>用来创建一个可写流</li>
</ul>
</li>
<li><ul>
<li>path 文件路径</li>
</ul>
</li>
<li><ul>
<li>options 配置的参数</li>
</ul>
</li>
<li><figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> fs = <span class="built_in">require</span>(<span class="string">'fs'</span>)</span><br><span class="line"><span class="keyword">var</span> ws = fs.createWriteStream(<span class="string">'hello4.txt'</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">//打开流和关闭流的事件监听</span></span><br><span class="line">ws.once(<span class="string">'open'</span>,<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">"流打开了"</span>)</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line">ws.once(<span class="string">'close'</span>,<span class="function"><span class="keyword">function</span> (<span class="params"></span>) </span>&#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'流关闭了'</span>)</span><br><span class="line">&#125;)</span><br><span class="line">ws.write(<span class="string">"玲珑骰子安红豆"</span>)</span><br><span class="line">ws.write(<span class="string">"入骨相思知不知"</span>)</span><br><span class="line">ws.write(<span class="string">"万里悲秋常作客"</span>)</span><br><span class="line">ws.write(<span class="string">"百年多病独登台"</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">//关闭流</span></span><br><span class="line">ws.end()</span><br></pre></td></tr></table></figure></li>
<li>1.同步文件的读取</li>
<li>2.异步文件的读取</li>
<li>3.简单文件的读取</li>
<li>4.流式文件的读取<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//简单文件的读取</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> fs = <span class="built_in">require</span>(<span class="string">'fs'</span>)</span><br><span class="line"></span><br><span class="line">fs.readFile(<span class="string">'ani.jpg'</span>,(err,data) =&gt; &#123;</span><br><span class="line">  <span class="keyword">if</span>(!err)&#123;</span><br><span class="line">    <span class="comment">//console.log(data)</span></span><br><span class="line">    <span class="comment">//写入到新的地方</span></span><br><span class="line">    fs.writeFile(<span class="string">'you.jpg'</span>,data,(err) =&gt; &#123;</span><br><span class="line">      <span class="keyword">if</span>(!err)&#123;</span><br><span class="line">        <span class="built_in">console</span>.log(<span class="string">'写入成功'</span>)</span><br><span class="line">      &#125;</span><br><span class="line">    &#125;)</span><br><span class="line">  &#125;</span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">//流式文件的读取  适用于大文件</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> fs = <span class="built_in">require</span>(<span class="string">'fs'</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">//创建一个可读流</span></span><br><span class="line"><span class="keyword">var</span> rs = fs.createReadStream(<span class="string">'hello4.txt'</span>)</span><br><span class="line"><span class="comment">//创建一个可写流</span></span><br><span class="line"><span class="keyword">var</span> ws = fs.createWriteStream(<span class="string">'a.txt'</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment">//监听流的开启和关闭</span></span><br><span class="line">rs.once(<span class="string">'open'</span>,() =&gt;&#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'可读流打开了'</span>)</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line">rs.once(<span class="string">'close'</span>,() =&gt; &#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'可读流关闭了'</span>)</span><br><span class="line">  ws.end()</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line">ws.once(<span class="string">'open'</span>,() =&gt;&#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'可写流打开了'</span>)</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line">ws.once(<span class="string">'close'</span>,() =&gt; &#123;</span><br><span class="line">  <span class="built_in">console</span>.log(<span class="string">'可写流关闭了'</span>)</span><br><span class="line">&#125;)</span><br><span class="line"></span><br><span class="line"><span class="comment">//如果要读取一个可读流中的数据，必须要可读流绑定一个data事件，data事件绑定完毕</span></span><br><span class="line"><span class="comment">//它会自动开始读取数据,数据通过回调函数的参数返回</span></span><br><span class="line">rs.on(<span class="string">'data'</span>,(data) =&gt; &#123;</span><br><span class="line">  <span class="comment">//console.log(data);</span></span><br><span class="line">  ws.write(data)</span><br><span class="line">&#125;)</span><br></pre></td></tr></table></figure>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">var</span> fs = <span class="built_in">require</span>(<span class="string">'fs'</span>)</span><br><span class="line"></span><br><span class="line"><span class="keyword">var</span> ws = fs.createWriteStream(<span class="string">'my.jpg'</span>)</span><br><span class="line"><span class="keyword">var</span> rs = fs.createReadStream(<span class="string">'ani.jpg'</span>)</span><br><span class="line"><span class="comment">//可以将可读流中的内容直接输出到可写流中</span></span><br><span class="line">rs.pipe(ws)</span><br></pre></td></tr></table></figure>
nodejs的东西还有很多，我只是例举其中很简单的东西，更多的内容，大家可以查看官方API<a href="http://nodejs.cn/api/" target="_blank" rel="noopener">链接</a><br>好了，我的分享就到这里了，谢谢大家！</li>
</ul>

      
      <!-- reward -->
      
      <div id="reward-btn">
        打赏
      </div>
      
    </div>
    
    
      <!-- copyright -->
      
        <div class="declare">
          <ul class="post-copyright">
            <li>
              <i class="ri-copyright-line"></i>
              <strong>版权声明： </strong s>
              本博客所有文章除特别声明外，均采用 <a href="https://www.apache.org/licenses/LICENSE-2.0.html" rel="external nofollow"
                target="_blank">Apache License 2.0</a> 许可协议。转载请注明出处！
            </li>
          </ul>
        </div>
        
    <footer class="article-footer">
      
          
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://lockme.gitee.io/2020/09/07/Node-js%E7%AE%80%E5%8D%95%E5%85%A5%E9%97%A8%E4%BB%8B%E7%BB%8D-md/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JavaScript/" rel="tag">JavaScript</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/Node-js/" rel="tag">Node.js</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E6%8A%80%E6%9C%AF/" rel="tag">技术</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/2020/09/07/Nodejs%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B-md/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            Nodejs快速上手.md
          
        </div>
      </a>
    
    
      <a href="/2020/09/07/%E7%96%AF%E7%8B%82%E7%9A%84jQuery-md/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">疯狂的jQuery.md</div>
      </a>
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        app_id: 'pmaQYnbUE9O0H1hiYKLiec4R-gzGzoHsz',
        app_key: 'LMujtI79W4vgEQ3Az5IMo50y',
        path: window.location.pathname,
        notify: 'false',
        verify: 'false',
        avatar: 'mp',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2020
        月下ctrlc
      </li>
      <li>
        
        Powered by
        
        
        <a href="https://hexo.io" target="_blank">Hexo</a> Theme <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
      <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
    <aside class="sidebar">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/avatar.jpg" alt="Small Bridge"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Vue/">Vue</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="http://shenyu-vip.lofter.com" target="_blank" rel="noopener">主题作者相册</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2020/03/18/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>拿钱砸死我吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.png">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.png">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
    
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/share.js"></script>


<script src="/js/lazyload.min.js"></script>


<script>
  try {
    var typed = new Typed("#subtitle", {
      strings: ['面朝大海，春暖花开', '愿你一生努力，一生被爱', '想要的都拥有，得不到的都释怀'],
      startDelay: 0,
      typeSpeed: 200,
      loop: true,
      backSpeed: 100,
      showCursor: true
    });
  } catch (err) {
  }

</script>




<script src="/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    onClick: (e) => {
      $('.toc-link').removeClass('is-active-link');
      $(`a[href=${e.target.hash}]`).addClass('is-active-link');
      $(e.target.hash).scrollIntoView();
      return false;
    }
  });
</script>



<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/js/ayer.js"></script>



<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>


<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script>
  var ayerConfig = {
    mathjax: true
  }
</script>



<script src="/js/busuanzi-2.3.pure.min.js"></script>



<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>


    
  </div>
</body>

</html>